package com.fjd.mapper;

import com.fjd.entity.Goods;
import com.fjd.entity.ShoppingProduct;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface ShoppingProductMapper {
    @Select("select * from product_category where product_id = #{id}")
    ShoppingProduct getById(String id);

    @Select("select min(price) from product_category where parent_id = #{parentId}")
    BigDecimal getCheapestPrice(String parentId);


    @Select("select * from product_category where parent_id  = #{productId} order by price")
    List<Goods> getByParentId(String productId);

    @Select("select * from product_category where parent_id  = #{parentId}")
    List<ShoppingProduct> getDetailByParentId(String parentId);

    @Select("select specification from product_category where product_id = #{productId}")
    String getSpecificationById(String productId);



}
